.audioPlayer {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.8);
}

.audioTitle {
  width: 140px;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.controls {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
}

.playButton {
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  &:hover:not(:disabled) {
    background-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
  }

  &:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }

  &.loading {
    animation: pulse 1.5s infinite;
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 0.8;
  }
  50% {
    opacity: 0.5;
  }
}

.progressContainer {
  flex: 1;
  display: flex;
  flex-direction: column;

  gap: 4px;
}

.progressWrapper {
  // 移除position: absolute, top: 0, left: 0，让进度条正常显示在容器中
  height: inherit; // 使用inherit而不是固定值，允许内联样式覆盖
  // 移除background-color，让内联样式控制背景色
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  transition: height 0.2s ease;
  position: relative; // 确保子元素的绝对定位基于此容器

  // 修改悬停效果，使用固定的高度增加值
  &:hover {
    height: calc(100% + 2px);
  }
}

.bufferedProgress {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.2);
  transition: width 0.3s ease;
  z-index: 1; // 保持最低的z-index，确保在底层
}

.currentProgress {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.8);
  transition: width 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 2; // 确保在缓冲进度条之上
  // 增强视觉区分度
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.progressHandle {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  // 动态设置滑块大小，基于进度条高度
  width: clamp(14px, calc(2.5 * 100%), 20px);
  height: clamp(14px, calc(2.5 * 100%), 20px);
  background-color: white;
  border-radius: 50%;
  cursor: var(--pointer);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: all 0.2s cubic-bezier(0.4, 0, 0, 1);
  opacity: 0;
  z-index: 3; // 保持最高z-index，确保在最上层
  will-change: transform, opacity;
  // 确保滑块与进度条高度完美适配
  margin-top: -0.5px;
}

// 调整滑块悬停和拖动样式
.progressWrapper:hover .progressHandle {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.2);
}

.progressSlider:active + .progressHandle {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.3);
  // cursor: grabbing;
  cursor: var(--pointer);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

.progressSlider {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  // cursor: pointer;
  cursor: var(--pointer);
  z-index: 4; // 保持最高z-index，确保可以接收鼠标事件
  opacity: 0;

  // 扩展可点击区域
  &::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 30px;
    height: 30px;
    background: transparent;
    // cursor: grab;
    cursor: var(--pointer);
  }

  &::-moz-range-thumb {
    width: 30px;
    height: 30px;
    background: transparent;
    // cursor: grab;
    cursor: var(--pointer);
    border: none;
  }

  &:active {
    // cursor: grabbing;
    cursor: var(--pointer);
  }

  &:disabled {
    cursor: not-allowed;
  }
}

// 增强进度条容器的交互体验
.progressWrapper {
  // 移除position: absolute, top: 0, left: 0，让进度条正常显示在容器中
  height: inherit; // 使用inherit而不是固定值，允许内联样式覆盖
  // 移除background-color，让内联样式控制背景色
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  transition: height 0.2s ease;
  position: relative; // 确保子元素的绝对定位基于此容器
  
  // 优化悬停效果，让交互更明显
  &:hover {
    height: calc(100% + 2px);
    // 可选：添加微弱的发光效果增强视觉反馈
    // box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3);
  }
  
  // 当进度条被点击/拖动时的样式
  &:active {
    // 可以添加额外的视觉反馈
  }
}

.timeDisplay {
  font-size: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  transition: opacity 0.3s ease;
}

.volumeControl {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 120px;
  transition: opacity 0.3s ease;
  opacity: 0.8;

  &:hover {
    opacity: 1;
  }
}

.muteButton {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  font-size: 16px;
  cursor: pointer;
  transition: transform 0.2s ease;

  &:hover {
    transform: scale(1.1);
  }
}

.volumeSlider {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  outline: none;
  transition: height 0.2s ease;

  &:hover {
    height: 6px;
  }

  &::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s ease;
  }

  &::-webkit-slider-thumb:hover {
    transform: scale(1.2);
  }

  &::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: transform 0.2s ease;
  }

  &::-moz-range-thumb:hover {
    transform: scale(1.2);
  }
}

/* 新增：其他操作按钮样式 */
.otherActions {
  position: relative;
}

.otherActionsButton {
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 4px;
  background-color: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;

  &:hover {
    background-color: rgba(255, 255, 255, 0.2);
  }
}

/* 新增：其他操作菜单样式 */
.otherActionsMenu {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  background-color: rgba(0, 0, 0, 0.9);
  border-radius: 4px;
  padding: 4px 0;
  min-width: 120px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  z-index: 100;
}

.otherActionsMenu button {
  width: 100%;
  padding: 8px 16px;
  text-align: left;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.2s ease;

  &:hover {
    background-color: rgba(255, 255, 255, 0.1);
  }
}
.audioDropdownMenu {
  padding: 8px; 
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}
.dropdownMenuItem {
  cursor: var(--pointer, pointer);
  border-radius: 4px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 4px;
  &:hover {
    background-color: rgba(255, 255, 255, 0.1);
  }
}